package com.luoxiang.socialandroid.dialog

import android.content.Context
import com.luoxiang.socialandroid.R
import com.luoxiang.socialandroid.databinding.DialogNewVersionBinding
import com.lxj.xpopup.impl.FullScreenPopupView

class NewVersionDialog(context: Context) : FullScreenPopupView(context) {
    private lateinit var mViewBinding: DialogNewVersionBinding
    private var onConfirmClickListener: (() -> Unit)? = null
    private var onCancleClickListener: (() -> Unit)? = null
    private var title: String? = null
    private var content: String? = null
    override fun getImplLayoutId() = R.layout.dialog_new_version

    override fun onCreate() {
        super.onCreate()
        mViewBinding = DialogNewVersionBinding.bind(popupImplView)
        mViewBinding.textTitle.text = title
        mViewBinding.textView12.text = content
        mViewBinding.textConfirm.setOnClickListener {
            onConfirmClickListener?.invoke()
        }
        mViewBinding.textView16.setOnClickListener {
            onCancleClickListener?.invoke()
            dismiss()
        }
    }

    fun setOnConfirmClickListener(onConfirmClickListener: () -> Unit) {
        this.onConfirmClickListener = onConfirmClickListener
    }
    fun setOnCancleClickListener(onCancleClickListener: () -> Unit) {
        this.onCancleClickListener = onCancleClickListener
    }

    fun setTitle(title: String) {
        this.title = title
    }

    fun setContent(content: String) {
        this.content = content
    }
}